import message from './index.vue';

export default {
  install(Vue, options) {
    // vue插件 
    const Message = Vue.extend(message)
    const $vm = new Message() // vue的实例
    const tpl = $vm.$mount().$el

    document.body.appendChild(tpl)

    Vue.prototype.$toast = {
      show() {
        $vm.show = true;
        $vm.timer = setTimeout(() => {
          $vm.show = false;
        }, 3000);
        console.log($vm.timer, '---------')
      },
      hide() {
        $vm.show = false
      }
    }
  }
}
